<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>递归法计算最大斐波那契数</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        h1 {
            text-align: center;
            color: #4CAF50;
            margin-bottom: 20px;
        }
        .container {
            max-width: 800px;
            margin: auto;
            padding: 20px;
            background-color: #ffffff;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        form {
            text-align: center;
            margin-bottom: 20px;
        }
        button {
            padding: 10px 20px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
        }
        button:hover {
            background-color: #45a049;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 30px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: center;
        }
        th {
            background-color: #f4f4f4;
            color: #555;
        }
        td {
            background-color: #fafafa;
        }
        tr:nth-child(even) td {
            background-color: #f9f9f9;
        }
        p {
            text-align: center;
            font-size: 18px;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>递归法计算本机支持的最大斐波那契数</h1>

        <!-- 表单提交 -->
        <form action="{% url 'max_fibonacci_recursive' %}" method="post">
            {% csrf_token %}
            <button type="submit">开始计算</button>
            <br>
            <br>
            <button><a href="{% url 'experiment1' %}" style="text-decoration: none; color: white">返回上一页</a></button>
        </form>

        <!-- 如果计算过后有结果，显示 -->
        {% if result %}
            <p>以下是计算的结果：</p>
            <table>
                <thead>
                    <tr>
                        <th>本机的位数</th>
                        <th>本机支持的最大整数</th>
                        <th>第几个斐波那契数</th>
                        <th>该斐波那契数的值</th>
                        <th>计算用时（微秒）</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>{{ result.bit_length }}</td>
                        <td>{{ result.max_int }}</td>
                        <td>{{ result.n }}</td>
                        <td>{{ result.fibonacci_value }}</td>
                        <td>{{ result.time_taken_ms }}</td>
                    </tr>
                </tbody>
            </table>
        {% endif %}
    </div>
</body>
</html>
